Within the field of computing, many scenarios involve a collection of objects that are organized in a hierarchical manner, such as a first object that encapsulates a collection of objects. In some scenarios, the hierarchical organization may be organized as a tree, in which the root node directly or indirectly encapsulates or owns all of the other objects, and in which the ownership relationship between an owning and an owned object is represented as a connection between a parent node and a child node.
In such scenarios, it is sometimes desirable to perform various forms of processing over the object set. For example, the objects comprise controls of a user interface within an encapsulating object such as a container, and it may be desirable to save the state of the object set by invoking a save( ) function on each of the objects. In order to ensure that each object receives the message and performs processing, the root node of the tree (representing the topmost object in an ownership order) may receive an invocation of the save task, and along with saving its own state, the root node may pass the task on to each of its child nodes. The downward propagation of the task by each node ensures that all objects represented by the nodes of the tree are invoked.
Additionally, in such scenarios, it is sometimes desirable to render the object set as a scene, such as a three-dimensional space of volumetric objects or a two-dimensional rendering of planar objects organized by priority or depth. For example, if the object set represents a collection of controls comprising a user interface such as a window, it may be desirable to invoke a render function on each of the user interface controls to generate a pictorial representation of the user interface. As with processing, the root node of the tree (representing the window) may receive an invocation of the draw task, and along with drawing its own properties, the window may pass the task on to each of its child nodes. The downward propagation of the draw task by each node ensures that all controls comprising the window are drawn into the user interface.